package com.ph.demo.JDKcurrent;

/**
 * Created by peng on 2019/4/13.
 */

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedDeque;

/**
 *
 * 并发容器及典型源码分析
 *
 * 把任意一个非线程安全集合修改为一个线程安全的集合  适用于并发量小的情况
 */
public class UtilsDemo {

    public static void main(String[] args) {
        Map<Object, Object> objectObjectMap = Collections.synchronizedMap(new HashMap<>());
        /**
         * 高并发的解决方案
         */
        ConcurrentHashMap concurrentHashMap = new ConcurrentHashMap();

        /**
         * 阻塞队列
         * BlockingQueue
         */

        /**
         * 高性能队列
         */
        ConcurrentLinkedDeque<Object> objects = new ConcurrentLinkedDeque<>();
    }
}
